import { Select } from "antd"
import { FC } from "react"

import { SFormItem } from "@/components/common"
import { useLocale } from "@/locales"
import { constant } from "@/utils/const"

const BuyTypeSelect: FC<{ isHideLabel?: boolean; width?: number }> = ({ isHideLabel = false, width = 200 }) => {
	const { newFormat } = useLocale()
	const formatOptions = constant.buyType.map((item: { code: number; description: string }) => ({
		label: item.description,
		value: item.code
	}))
	return (
		<SFormItem name="buyType" label={isHideLabel ? "" : newFormat("dxn.game_list.purchase_type")}>
			<Select allowClear placeholder={newFormat("common.select_all")} options={formatOptions} style={{ width: width }} />
		</SFormItem>
	)
}

export default BuyTypeSelect
